<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Signals sent by the comments app &mdash; Django 1.7.8.dev20150401230226 documentation</title>
    
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.7.8.dev20150401230226',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <link rel="top" title="Django 1.7.8.dev20150401230226 documentation" href="../../../index.html" />
    <link rel="up" title="Django’s comments framework" href="index.html" />
    <link rel="next" title="Customizing the comments framework" href="custom.html" />
    <link rel="prev" title="The built-in comment models" href="models.html" />



 
<script type="text/javascript" src="../../../templatebuiltins.js"></script>
<script type="text/javascript">
(function($) {
    if (!django_template_builtins) {
       // templatebuiltins.js missing, do nothing.
       return;
    }
    $(document).ready(function() {
        // Hyperlink Django template tags and filters
        var base = "../../templates/builtins.html";
        if (base == "#") {
            // Special case for builtins.html itself
            base = "";
        }
        // Tags are keywords, class '.k'
        $("div.highlight\\-html\\+django span.k").each(function(i, elem) {
             var tagname = $(elem).text();
             if ($.inArray(tagname, django_template_builtins.ttags) != -1) {
                 var fragment = tagname.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + tagname + "</a>");
             }
        });
        // Filters are functions, class '.nf'
        $("div.highlight\\-html\\+django span.nf").each(function(i, elem) {
             var filtername = $(elem).text();
             if ($.inArray(filtername, django_template_builtins.tfilters) != -1) {
                 var fragment = filtername.replace(/_/, '-');
                 $(elem).html("<a href='" + base + "#" + fragment + "'>" + filtername + "</a>");
             }
        });
    });
})(jQuery);
</script>


  </head>
  <body>

    <div class="document">
  <div id="custom-doc" class="yui-t6">
    <div id="hd">
      <h1><a href="../../../index.html">Django 1.7.8.dev20150401230226 documentation</a></h1>
      <div id="global-nav">
        <a title="Home page" href="../../../index.html">Home</a>  |
        <a title="Table of contents" href="../../../contents.html">Table of contents</a>  |
        <a title="Global index" href="../../../genindex.html">Index</a>  |
        <a title="Module index" href="../../../py-modindex.html">Modules</a>
      </div>
      <div class="nav">
    &laquo; <a href="models.html" title="The built-in comment models">previous</a>
     |
    <a href="../../index.html" title="API Reference" accesskey="U">up</a>
   |
    <a href="custom.html" title="Customizing the comments framework">next</a> &raquo;</div>
    </div>

    <div id="bd">
      <div id="yui-main">
        <div class="yui-b">
          <div class="yui-g" id="ref-contrib-comments-signals">
            
  <div class="section" id="s-module-django.contrib.comments.signals">
<span id="s-signals-sent-by-the-comments-app"></span><span id="module-django.contrib.comments.signals"></span><span id="signals-sent-by-the-comments-app"></span><h1>Signals sent by the comments app<a class="headerlink" href="#module-django.contrib.comments.signals" title="Permalink to this headline">¶</a></h1>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p>Django&#8217;s comment framework has been deprecated and is no longer supported.
Most users will be better served with a custom solution, or a hosted
product like <a class="reference external" href="https://disqus.com/">Disqus</a>.</p>
<p class="last">The code formerly known as <tt class="docutils literal"><span class="pre">django.contrib.comments</span></tt> is <a class="reference external" href="https://github.com/django/django-contrib-comments">still available
in an external repository</a>.</p>
</div>
<p>The comment app sends a series of <a class="reference internal" href="../../../topics/signals.html"><em>signals</em></a> to allow for
comment moderation and similar activities. See <a class="reference internal" href="../../../topics/signals.html"><em>the introduction to signals</em></a> for information about how to register for and receive these
signals.</p>
<div class="section" id="s-comment-will-be-posted">
<span id="comment-will-be-posted"></span><h2>comment_will_be_posted<a class="headerlink" href="#comment-will-be-posted" title="Permalink to this headline">¶</a></h2>
<dl class="data">
<dt id="django.contrib.comments.signals.comment_will_be_posted">
<tt class="descclassname">django.contrib.comments.signals.</tt><tt class="descname">comment_will_be_posted</tt><a class="headerlink" href="#django.contrib.comments.signals.comment_will_be_posted" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Sent just before a comment will be saved, after it&#8217;s been sanity checked and
submitted. This can be used to modify the comment (in place) with posting
details or other such actions.</p>
<p>If any receiver returns <tt class="docutils literal"><span class="pre">False</span></tt> the comment will be discarded and a 400
response will be returned.</p>
<p>This signal is sent at more or less the same time (just before, actually) as the
<tt class="docutils literal"><span class="pre">Comment</span></tt> object&#8217;s <a class="reference internal" href="../../signals.html#django.db.models.signals.pre_save" title="django.db.models.signals.pre_save"><tt class="xref py py-data docutils literal"><span class="pre">pre_save</span></tt></a> signal.</p>
<p>Arguments sent with this signal:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">sender</span></tt></dt>
<dd>The comment model.</dd>
<dt><tt class="docutils literal"><span class="pre">comment</span></tt></dt>
<dd>The comment instance about to be posted. Note that it won&#8217;t have been
saved into the database yet, so it won&#8217;t have a primary key, and any
relations might not work correctly yet.</dd>
<dt><tt class="docutils literal"><span class="pre">request</span></tt></dt>
<dd>The <a class="reference internal" href="../../request-response.html#django.http.HttpRequest" title="django.http.HttpRequest"><tt class="xref py py-class docutils literal"><span class="pre">HttpRequest</span></tt></a> that posted the comment.</dd>
</dl>
</div>
<div class="section" id="s-comment-was-posted">
<span id="comment-was-posted"></span><h2>comment_was_posted<a class="headerlink" href="#comment-was-posted" title="Permalink to this headline">¶</a></h2>
<dl class="data">
<dt id="django.contrib.comments.signals.comment_was_posted">
<tt class="descclassname">django.contrib.comments.signals.</tt><tt class="descname">comment_was_posted</tt><a class="headerlink" href="#django.contrib.comments.signals.comment_was_posted" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Sent just after the comment is saved.</p>
<p>Arguments sent with this signal:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">sender</span></tt></dt>
<dd>The comment model.</dd>
<dt><tt class="docutils literal"><span class="pre">comment</span></tt></dt>
<dd>The comment instance that was posted. Note that it will have already
been saved, so if you modify it you&#8217;ll need to call
<a class="reference internal" href="../../models/instances.html#django.db.models.Model.save" title="django.db.models.Model.save"><tt class="xref py py-meth docutils literal"><span class="pre">save()</span></tt></a> again.</dd>
<dt><tt class="docutils literal"><span class="pre">request</span></tt></dt>
<dd>The <a class="reference internal" href="../../request-response.html#django.http.HttpRequest" title="django.http.HttpRequest"><tt class="xref py py-class docutils literal"><span class="pre">HttpRequest</span></tt></a> that posted the comment.</dd>
</dl>
</div>
<div class="section" id="s-comment-was-flagged">
<span id="comment-was-flagged"></span><h2>comment_was_flagged<a class="headerlink" href="#comment-was-flagged" title="Permalink to this headline">¶</a></h2>
<dl class="data">
<dt id="django.contrib.comments.signals.comment_was_flagged">
<tt class="descclassname">django.contrib.comments.signals.</tt><tt class="descname">comment_was_flagged</tt><a class="headerlink" href="#django.contrib.comments.signals.comment_was_flagged" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<p>Sent after a comment was &#8220;flagged&#8221; in some way. Check the flag to see if this
was a user requesting removal of a comment, a moderator approving/removing a
comment, or some other custom user flag.</p>
<p>Arguments sent with this signal:</p>
<dl class="docutils">
<dt><tt class="docutils literal"><span class="pre">sender</span></tt></dt>
<dd>The comment model.</dd>
<dt><tt class="docutils literal"><span class="pre">comment</span></tt></dt>
<dd>The comment instance that was posted. Note that it will have already
been saved, so if you modify it you&#8217;ll need to call
<a class="reference internal" href="../../models/instances.html#django.db.models.Model.save" title="django.db.models.Model.save"><tt class="xref py py-meth docutils literal"><span class="pre">save()</span></tt></a> again.</dd>
<dt><tt class="docutils literal"><span class="pre">flag</span></tt></dt>
<dd>The <tt class="docutils literal"><span class="pre">django.contrib.comments.models.CommentFlag</span></tt> that&#8217;s been attached to
the comment.</dd>
<dt><tt class="docutils literal"><span class="pre">created</span></tt></dt>
<dd><tt class="docutils literal"><span class="pre">True</span></tt> if this is a new flag; <tt class="docutils literal"><span class="pre">False</span></tt> if it&#8217;s a duplicate flag.</dd>
<dt><tt class="docutils literal"><span class="pre">request</span></tt></dt>
<dd>The <a class="reference internal" href="../../request-response.html#django.http.HttpRequest" title="django.http.HttpRequest"><tt class="xref py py-class docutils literal"><span class="pre">HttpRequest</span></tt></a> that posted the comment.</dd>
</dl>
</div>
</div>


          </div>
        </div>
      </div>
      
        
          <div class="yui-b" id="sidebar">
            
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Signals sent by the comments app</a><ul>
<li><a class="reference internal" href="#comment-will-be-posted">comment_will_be_posted</a></li>
<li><a class="reference internal" href="#comment-was-posted">comment_was_posted</a></li>
<li><a class="reference internal" href="#comment-was-flagged">comment_was_flagged</a></li>
</ul>
</li>
</ul>

  <h3>Browse</h3>
  <ul>
    
      <li>Prev: <a href="models.html">The built-in comment models</a></li>
    
    
      <li>Next: <a href="custom.html">Customizing the comments framework</a></li>
    
  </ul>
  <h3>You are here:</h3>
  <ul>
      <li>
        <a href="../../../index.html">Django 1.7.8.dev20150401230226 documentation</a>
        
          <ul><li><a href="../../index.html">API Reference</a>
        
          <ul><li><a href="../index.html"><tt class="docutils literal"><span class="pre">contrib</span></tt> packages</a>
        
          <ul><li><a href="index.html">Django&#8217;s comments framework</a>
        
        <ul><li>Signals sent by the comments app</li></ul>
        </li></ul></li></ul></li></ul>
      </li>
  </ul>

  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../_sources/ref/contrib/comments/signals.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
              <h3>Last update:</h3>
              <p class="topless">Apr 02, 2015</p>
          </div>
        
      
    </div>

    <div id="ft">
      <div class="nav">
    &laquo; <a href="models.html" title="The built-in comment models">previous</a>
     |
    <a href="../../index.html" title="API Reference" accesskey="U">up</a>
   |
    <a href="custom.html" title="Customizing the comments framework">next</a> &raquo;</div>
    </div>
  </div>

      <div class="clearer"></div>
    </div>
  </body>
</html>